1. Field of the Invention
The invention relates in general to a communication system, and more particularly to packet forwarding device and method using a virtual port.
2. Description of the Related Art
Most of the conventional network switches are the Layer 2 dumb switch, which can only simply forward the packet to the corresponding port of the dumb switch using a Layer-2 forwarding unit according to a target MAC address of the packet. As for Layer 3 or higher function, such as routing, network address translation (NAT) or access control list (ACL), the packet forwarding has to be processed by a CPU so that where the packet should be transferred may be determined. Thus, the CPU spends a lot of time in executing the associated network protocol software. If the higher packet forwarding speed has to be reached, the CPU with the faster processing speed has to be used. However, when a new application appears, the application requirement cannot be satisfied until the upgrade is made. Nevertheless, because the current CPU, the switch controller and other peripheral interfaces have been combined into a single chip system, the replacement of the CPU means that the overall chip has to be replaced and the system has to be redesigned, which spends too much time and cost.
In addition, some conventional switch controllers have incorporated Layer 3 or higher function, and directly perform the packet forwarding function using a Multi-Layer (at least Layer-2 and Layer-3) forwarding unit and substantially without the processing of the CPU. Instead, the CPU only has to process the packet that cannot be processed by the switch controller. As for Layer 3 or higher function, power consumed by the CPU is greatly saved because the CPU does not have to process in most cases and most of the CPU's operational resource can be kept for other functions. On the other hand, because the packet forwarding is directly completed by the Multi-Layer forwarding unit of the switch controller, these functions may be performed at the wirespeed, and the system efficiency may be greatly enhanced.
However, in the switch incorporated with other peripheral interfaces such as PCI, USB, and PCMCIA, the packet outputted from or inputted to the peripheral interfaces has to be processed by the CPU that executes the associated network protocol software. FIG. 1 is a schematic illustration showing an internal packet forwarding procedure of a switch 10. The switch 10 includes a CPU 11, a forwarding unit 12 (which can be a Layer-2 or Multi-Layer forwarding unit) and a peripheral interface 13. As shown in FIG. 1, the CPU 11 executes proper network protocol software as well as the drivers for the forwarding unit 12 and the peripheral interface 13 so as to transfer the packet to peripheral interface 13. The peripheral interface 13 may be connected to the external network device, such as a WLAN network adapter.
As shown in FIG. 1, most of the packets (including Layer 2 , Layer 3 or higher) inputted to or outputted from the forwarding unit 12 are directly forwarded through the transfer path 1. Only a few packets (Layer 3 or higher) inputted to or outputted from the forwarding unit 12 are forwarded through the transfer path 2, and are processed by the CPU 11 that executes the associated network protocol software. The CPU 11 includes at least one network protocol software and a driver layer which includes a forwarding unit driver and peripheral driver. All the packets inputted to or outputted from the peripheral interface 13 are forwarded through the transfer path 3 are processed by the CPU 11 that executes the associated network protocol software. Thus, the switch 10 directly and quickly forwards the packets that are only inputted to or outputted from the physical port of the forwarding unit 12. As for the packets that are transferred between the forwarding unit 12 and the peripheral interface 13, the CPU 11 still has to be used to execute the associated network protocol software in order to forward these packets because the peripheral interface 13 is not the physical port of the switch 10. These packets may be regarded as being indirectly forwarded through the associated software. In other words, all the packets that are transferred between the forwarding unit 12 and the peripheral interface 13 still have to be processed by the associated network protocol software, which has to execute all the conventional procedures such as bridging, routing, NAT or filtering according to the properties of the packets. Consequently, the software has to be designed to execute various process methods according to various packets coming from the forwarding unit 12 and the peripheral interface 13, thereby enlarging the program, increasing the setup and management complexities of the software, and further slowing down the system's operation speed.